(defun c:setprofilelayers ( / )
  (vl-load-com)
  (setq aecc_prof_ss (ssget '((-4 . "<OR")(0 . "AECC*PROFILE*")(0 . "*VALIGNMENT*LABEL_GROUP")(-4 . "OR>"))))
  (setq prof_ss_len (SSLENGTH aecc_prof_ss))
  (SETQ prof_ss_cnt 0
        prof_ename NIL
  )
  (WHILE (AND
           (OR
             (NOT prof_ename)
             (WCMATCH(CDR(ASSOC 0(ENTGET prof_ename))) "AECC*PROFILE*,*VALIGNMENT*LABEL_GROUP")
           )
           (< prof_ss_cnt prof_ss_len)
         )
    (SETQ prof_ename (SSNAME aecc_prof_ss prof_ss_cnt))
    (SETQ prof_ss_cnt (1+ prof_ss_cnt))
  )
  (IF prof_ename
    (PROGN
      (SETQ prof_obj (VLAX-ENAME->VLA-OBJECT prof_ename))
      (COND
        ((VLAX-PROPERTY-AVAILABLE-P prof_obj 'Profile)
          (SETQ prof_alignment (VLAX-GET-PROPERTY(VLAX-GET-PROPERTY prof_obj 'Profile)'Alignment)))
        ((VLAX-PROPERTY-AVAILABLE-P prof_obj 'Parent)
          (SETQ prof_alignment (VLAX-GET-PROPERTY prof_obj 'Parent)))
        ((VLAX-PROPERTY-AVAILABLE-P prof_obj 'Alignment)
          (SETQ prof_alignment (VLAX-GET-PROPERTY prof_obj 'Alignment)))
      )
      (SETQ prof_name (VLAX-GET-PROPERTY prof_alignment 'Name))
    )
  )
  (PRINC (STRCAT "\nProfile objects parent alignment is \"" prof_name "\""))
  (IF ustr NIL (LOAD "ustr" "\nFile USTR.LST not loaded! "))
  (WHILE (NOT (AND new_userd (EQ (STRLEN new_userd) 4)))
    (SETQ new_userd (ustr 1 "Enter a unique 4-character string for these profile objects" (IF (AND prof_userd (EQ (STRLEN prof_userd) 4)) prof_userd nil) T))
  )
  (SETQ prof_userd new_userd
        new_userd NIL
        prof_assoc_8_lst NIL
  )
  (IF prof_userd
    (PROGN
      (SETQ prof_obj_layer (STRCAT "C-PROF-OBJS-" prof_userd)
            prof_view_obj_layer (STRCAT "C-PROF-VIEW-OBJS-" prof_userd)
            prof_label_obj_layer (STRCAT "C-PROF-LABL-OBJS-" prof_userd)
            prof_assoc_8_lst (APPEND prof_assoc_8_lst (LIST (CONS 8 prof_obj_layer)(CONS 8 prof_view_obj_layer)(CONS 8 prof_label_obj_layer)))
      )
      (IF make_layer_ent NIL (LOAD "make_layer_ent" "\nFile MAKE_LAYER_ENT.LSP not loaded! "))
      (make_layer_ent prof_assoc_8_lst)
      (SETQ prof_ss_cnt 0)
      (WHILE (< prof_ss_cnt prof_ss_len)
        (SETQ prof_ename (SSNAME aecc_prof_ss prof_ss_cnt))
        (SETQ prof_obj (VLAX-ENAME->VLA-OBJECT prof_ename))
        (COND
          ((WCMATCH (CDR (ASSOC 0 (ENTGET prof_ename))) "*VALIGNMENT*LABEL_GROUP")
           (VLAX-PUT-PROPERTY prof_obj 'Layer prof_label_obj_layer)
           )
          ((EQ (CDR (ASSOC 0 (ENTGET prof_ename))) "AECC_PROFILE")
           (VLAX-PUT-PROPERTY prof_obj 'Layer prof_obj_layer)
           )
          ((EQ (CDR (ASSOC 0 (ENTGET prof_ename))) "AECC_PROFILE_VIEW")
           (VLAX-PUT-PROPERTY prof_obj 'Layer prof_view_obj_layer)
           )
        )
        (SETQ prof_ss_cnt (1+ prof_ss_cnt))
      )
    )
  )
  (princ)
)
(DEFUN c:setprlay ()
  (c:setprofilelayers)
)
